package com.example.dell.avtivity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.widget.LinearLayout;

import newfragment.SignInMain;

/**
 * Created by dell on 2017/1/26.
 */

public class SignIn extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        replaceFragment(new SignInMain());
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
//        setBackoundgradient(60);
    }


    private void replaceFragment(Fragment fragment) {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = manager.beginTransaction();
        fragmentTransaction.replace(R.id.replacefragment, fragment);
        fragmentTransaction.commit();
    }

    private void setBackoundgradient(int gradient) {
        LinearLayout replacefragment = (LinearLayout) findViewById(R.id.replacefragment);
        LinearLayout userpic_view = (LinearLayout) findViewById(R.id.user_pic);
        replacefragment.getBackground().setAlpha(gradient);
        userpic_view.getBackground().setAlpha(gradient);
    }
}
